#!/bin/bash

total=$#

alert_dir=$(cat config.cnf | grep AlertDir | awk -F "=" '{print $2}')
[[ ! -f "${alert_dir}" ]] && mkdir -p ${alert_dir}

for type in $@; do
    if [[ $type == "osssync" ]]; then
        nohup ./oss_sync_check.sh >> alarm.log 2>&1 &
	elif [[ $type == "monitor_script" ]]; then
		scripts_name=$(echo $@ | awk '{$1="";print $0}')
		nohup ./monitor_script_check.sh $scripts_name >> alarm.log 2>&1 &
		echo "start monitor_script_check.sh success"
		exit 0
    else
        # type is canal, ha, mariadb, nginx, rabbitmq, tomcat
        nohup ./${type}_check.sh >> alarm.log 2>&1 &
		echo "start ${type}_check.sh success"
    fi
done

#nohup ./clean_daily.sh >> alarm.log 2>&1 &
